package Test;

import java.util.List;


import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.demo.entity.ScoreVo;
import com.demo.entity.Totalscore;
import com.demo.service.TotalScoreService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:spring/spring-*.xml")
public class TotalScoreTest {
	@Autowired
	private TotalScoreService totalScoreService;
	//查询成绩 学生 课程 信息
	@Test
	public void selectAllScoreVo() throws Exception {
		List<ScoreVo> selectAllScoreVo = totalScoreService.selectAllScoreVo();
		for (ScoreVo scoreVo : selectAllScoreVo) {
			System.out.println(scoreVo);
		}
	}
	@Test
	public void add()throws Exception{
		Totalscore totalscore = new Totalscore();
		totalscore.setId("t5");
		totalscore.setStudentid("s2");
		totalscore.setScore(99);
		totalscore.setCourseid("co6");
		int addTotalScore = totalScoreService.addTotalScore(totalscore);
		System.out.println(addTotalScore);
	}
	@Test
	public void delete()throws Exception{
		int deleteTotalScoreById = totalScoreService.deleteTotalScoreById("t4");
		System.out.println(deleteTotalScoreById);
		
	}
	@Test
	public void selectById()throws Exception{
		Totalscore selectTotalScoreById = totalScoreService.selectTotalScoreById("t5");
		System.out.println(selectTotalScoreById);
		
	}
	@Test
	public void selectAll()throws Exception{
		List<Totalscore> selectAllTotalScore = totalScoreService.selectAllTotalScore();
		for (Totalscore totalscore : selectAllTotalScore) {
			System.out.println(totalscore);
		}
	}
	@Test
	public void selectAllTotalScoreVo()throws Exception{
		 List<Totalscore> allTotalScoreVo = totalScoreService.AllTotalScoreVo();
		 for (Totalscore totalscore : allTotalScoreVo) {
			System.out.println(totalscore);
		}
	}
	@Test
	public void findScoreVoscoc()throws Exception{
		ScoreVo scoreVo = new ScoreVo();
		scoreVo.setSname("");
		scoreVo.setClassName("");
		scoreVo.setCourseName("语文");
		List<ScoreVo> findScoreVoscoc = totalScoreService.findScoreVoscoc(scoreVo);
		for (ScoreVo scoreVo2 : findScoreVoscoc) {
			System.out.println(scoreVo2);
		}
	}
}
